Repository navigation
DEV-1125: report BMP390 values as not calibrated when no coefficients exist - #315
Merged
Merged
Conversation
… exist CalibDetailsBmp390 keeps its coefficients in a static map keyed by MAC. parseCalParamByteArray() skips an all-0x00/0xFF block without storing anything, and calibratePressureSensorData() then dereferenced the missing entry and threw a NullPointerException - aborting a whole SD import whose header carried no BMP390 coefficients, and any stream sampled before the 0xA7 reply. It now returns NaN for pressure and temperature instead. The BMP180 and BMP280 fall back to default coefficients, but there are no published defaults for the BMP390, and inventing them would print plausible wrong numbers; NaN matches the web SDK, which returns null without coefficients. API_00024 covers all-zero, all-0xFF and never-parsed blocks, a valid block still calibrating within range, and a later blank block not erasing earlier coefficients. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JongChern
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes DEV-1125.
Defect
CalibDetailsBmp390keeps its coefficients in a static map keyed by MAC address.parseCalParamByteArray()skips an all-0x00/0xFFblock without storing anything.calibratePressureSensorData()then dereferenced the missing entry and threw a NullPointerException.That aborted a whole SD import whose header carried no BMP390 coefficients, and could do the same to any stream sampled before the 0xA7 coefficient reply. Found while writing DEV-1123's tests (ShimmerResearch/Shimmer-Advance-API#490), which had to use non-zero coefficients to avoid it.
Fix
calibratePressureSensorData()now returnsNaNfor pressure and temperature instead of throwing.resetToDefaultParameters()is empty). Inventing them would print plausible-looking wrong numbers.NaNmatches the web SDK, whosecompensatePressurereturnsnullwithout coefficients.Testing
API_00024_Bmp390MissingCoefficientsTest(5 tests): all-zero block, all-0xFFblock and never-parsed sensor each giveNaNwithout throwing; a real trim block still calibrates within the BMP390's range; a later blank block doesn't erase coefficients already parsed.cd ShimmerDriver && ./gradlew test: 124 tests, 0 failures.Siblings (CLAUDE.md §4)
null).CalibratePressure390SensorDatauses instance fields that default to 0. With no parsed block it silently outputs garbage labelled as calibrated. Not fixed here, because DEV-1107: BMP581 pressure sensor support (Shimmer3R streaming + SD log) Shimmer-C-API#208 and DEV-196 Changing Shimmer3r to Shimmer3R for greater impact #210 are in flight on the same code; noted on DEV-1125.🤖 Generated with Claude Code